package view;

import java.util.Observable;


import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.SWT;


public class Game2048View extends Observable implements View,Runnable {

	Display display;
	Shell shell;
	
	private void initCopmonents(){
		display = new Display();
		shell = new Shell(display);
		shell.setLayout(new GridLayout(2,false));
		shell.setSize(400,300);
		shell.setText("2048 Game");
		
		Button b1 = new Button(shell, SWT.PUSH);
		b1.setText("Start");
		b1.setLayoutData(new GridData(SWT.FILL, SWT.TOP,false,false,1,1));
		
		Board board = new Board(shell,SWT.BORDER);
		board.setLayoutData(new GridData(SWT.FILL, SWT.FILL,true,true,1,2));
		
		Button b2 = new Button(shell, SWT.PUSH);
		b2.setText("Reset");
		b2.setLayoutData(new GridData(SWT.FILL, SWT.TOP,false,false,1,1));
				
		shell.open();
	}
	public void displayData(int[][] data) {
		// TODO Auto-generated method stub

	}

	public int getUserCommand() {
		// TODO Auto-generated method stub
		return 0;
	}


	public void run() {
		initCopmonents();
		while (!shell.isDisposed()){
			if (!display.readAndDispatch()){
				display.sleep();
			}
		}
		display.dispose();
		
	}


}
